import os
import sys

# 请在此输入您的代码
days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

a = {"零": 13, "一": 1, "二": 2, "三": 3, "四": 5, "五": 4, "六": 4, "七": 2, "八": 2, "九": 2}
b = {"0": "零", "1": "一", "2":"二", "3": "三", "4": "四", "5": "五", "6": "六", "7": "七", "8": "八", "9": "九"}

# 转换日期 为 大写
# 20000 01 01
def zhuan(y, m, d):
    # 年月日
    res = ""
    for c in str(y):
        res += b[c]

    # if len(m) == 1:
    #     res += b["0"]
    m = str(m).zfill(2)
    for c in m:
        res += b[c]

    # if len(d) == 1:
    #     res += b["0"]
    d = str(d).zfill(2)   # zfill 补充字符串长度到指定位置，少的高位补0
    for c in d:
        res += b[c]

    # 转换和
    ans=0
    for c in res:
        ans+=a[c]
    return ans

# 计算天数
def count_day(start_y,start_m,start_d,end_y,end_n,end_d):

    ans=0
    # 遍历年
    for y in range(start_y,end_y+1):
        # 遍历月
        # 最后一年
        # 开始月份的确定
        # start_month = start_m if y==start_y else 1
        # end_month = end_n if y==end_y else 12
        # for m in range(start_month,end_month+1):
        for m in range(1,13):
            dd = days[m]
            # 判断闰年
            if (y%4==0 and y%100!=0) or (y%400==0):
                if m == 2:
                    dd+=1
            # 遍历天数
            # start_day = start_d if y==start_y and m==start_m else 1
            # end_day = end_d if y==end_y and m==end_n else dd
            # for d in range(start_day,end_day+1):
            for d in range(1,dd+1):
                # 转换 和
                cnt=zhuan(y,m,d)
                if cnt>50:
                     ans+=1
                if y==end_y and m == end_n and d==end_d:
                    return ans
    # return ans
start = 2000
end = 2024
# res = zhuan(str(end), "1", "1")
# print(res)

print(count_day(start, 1, 1, end, 4, 13))